import { ItemData } from "../../resource/info/ItemData";
import { ItemsUtil } from "../shortcuts/item/ItemsUtil";
import { ObjCreate } from "../common/ObjCreate";
import { GTextFormat } from "../../../common/GTextFormat";
import { ImagesConst } from "../../resource/ImagesConst";
import { BaseItem } from "../common/BaseItem";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class LuckyBagFrontSp
    
    export  class LuckyBagFrontSp /* flash.display.Sprite */
    {
        constructor(arg1: int, arg2: int)
        {
            
            this._code = arg1;
            this._num = arg2;
            this.initView();
            this.setData(arg1, arg2);
            return;
        }

        /* internal  */setData(arg1: int, arg2: int): void
        {
            this._idata = new ItemData(arg1);
            if (this._idata && !(this._idata == ItemData.nullItemData)) 
            {
                this._baseItem.itemData = this._idata;
                this._baseItem.amount = arg2;
                this._nameTxt.htmlText = ItemsUtil.getItemName(this._idata);
            }
            else 
            {
                this._baseItem.itemData = null;
                this._nameTxt.htmlText = "";
            }
            return;
        }

        /* internal  */initView(): void
        {
            this._bg = ObjCreate.createBitmap("", 0, 0, this);
            var loc1=new GTextFormat("", 12, null, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._nameBg = ObjCreate.createBg(9, 20, 90, 20, this, ImagesConst.FightingStrgBg);
            this._nameTxt = ObjCreate.createTextField("", 4, 20, 95, 20, this, loc1);
            this._itemBg = ObjCreate.createBg(19, 50, 65, 65, this, ImagesConst.PackItemBg);
            this._baseItem = new BaseItem();
            this._baseItem.move(22, 53);
            this._baseItem.setSize(60, 60);
            this._baseItem.setAmountLabelPos(0, 45);
            this._baseItem.isDragAble = false;
            this._baseItem.isDropAble = false;
            this._baseItem.isShowLock = true;
            addChild(this._baseItem);
            LoaderHelp.addResCallBack(ResFileConst.LuckyBag, this.onLoadBmResource);
            return;
        }

        /* internal  */onLoadBmResource(): void
        {
            this._bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.LuckyBag_FrontBg);
            return;
        }

        public changeInfo(arg1: int, arg2: int): void
        {
            this.setData(arg1, arg2);
            return;
        }

        /* internal */ /* var */_idata: ItemData;

        /* internal */ /* var */_code: int;

        /* internal */ /* var */_num: int;

        /* internal */ /* var */_bg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_nameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_nameBg: ScaleBitmap;

        /* internal */ /* var */_itemBg: ScaleBitmap;
    }
